<template>
	<view class="template-order">
		<!-- 顶部自定义导航 -->
		<tn-nav-bar fixed alpha customBack>
			<view slot="back" class='tn-custom-nav-bar__back' @click="goBack">
				<text class='icon tn-icon-left-arrow'></text>
			</view>
		</tn-nav-bar>
		<view class="order-wrap" :style="{marginTop: vuex_custom_bar_height + 'px'}">
			<!-- 顶部标签 -->
			<tn-tabs-swiper ref="tabs" :list="list" :current="tabsIndex" :isScroll="false" @change="tabsChange">
			</tn-tabs-swiper>
			<!-- 标签内容 -->
			<swiper class="swiper__box" :current="swiperIndex" @transition="swiperTransition"
				@animationfinish="swiperAnimationFinish">
				<swiper-item class="swiper__item">
					<tn-form :model="form" ref="form" :errorType="['message']" labelWidth="140" borderBottom="false">
						<!-- <tn-form-item label="性别:" prop="sex">
							<tn-radio-group v-model="form.sex">
								<tn-radio v-for="(item, index) in sexRadioList" :key="index" :name="item.name">
									{{ item.name }}
								</tn-radio>
							</tn-radio-group>
						</tn-form-item> -->

						<tn-form-item label="婚史:" prop="marriageHistory">
							<tn-radio-group v-model="form.marriageHistory">
								<tn-radio v-for="(item, index) in smailRadioList" :key="index" :name="item.name">
									{{ item.name }}
								</tn-radio>
							</tn-radio-group>
						</tn-form-item>
						<tn-form-item v-if="form.marriageHistory === '离异'" label="是否有子女:" prop="ifChild">
							<tn-radio-group v-model="form.haveChild">
								<tn-radio v-for="(item, index) in childList" :key="index" :name="item.name"
									:disabled="item.disabled">
									{{ item.name }}
								</tn-radio>
							</tn-radio-group>
						</tn-form-item>
						<tn-form-item label="出生日期:" prop="birthday">
							<tn-input v-model="form.birthday" placeholder="请选择出生日期" @click="showAarried" disabled="true"/>
							<tn-picker :safeAreaInsetBottom="true" @confirm="changeDate" mode="time" :params="params" v-model="marriedShow"
								placeholder="请选择出生日期"></tn-picker>
						</tn-form-item>
						<tn-form-item label="民族:" prop="nation">
							<tn-input v-model="form.nation" placeholder="请选择民族" @click="showNations" disabled="true"/>
							<tn-select :safeAreaInsetBottom="true" v-model="nationsShow" @confirm="choseNation" mode="single" :list="nations">
							</tn-select>
						</tn-form-item>
						<tn-form-item label="家乡:" prop="birthPlace">
							<tn-input v-model="form.birthPlace" placeholder="请选择地址" @click="showBirthAddress" disabled="true"/>
							<tn-picker v-model="birthAddressShow" :params="birthAddressParams" @confirm="choseBirthAddress"
								mode="region" :defaultRegin="defaultRegin"></tn-picker>
						</tn-form-item>
						<tn-form-item label="现居地:" prop="presentPlace">
							<tn-input v-model="form.presentPlace" placeholder="请选择地址" @click="showAddress" disabled="true"/>
							<tn-picker v-model="addressShow" :params="addressParams" @confirm="choseAddress"
								mode="region" :defaultRegin="defaultAddress"></tn-picker>
						</tn-form-item>

						<tn-form-item label="学历:" prop="educationBackground">
							<tn-input v-model="form.educationBackground"  placeholder="请选择学历" @click="showEducation" disabled="true"/>
							<tn-select @confirm="changeEducation" v-model="educationBackgroundShow" mode="single"
								:list="radioList"></tn-select>
						</tn-form-item>
						<tn-form-item label="身高:" prop="height">
							<tn-input v-model="form.height" placeholder="请选择身高" @click="this.heightShow = true" disabled="true"/>
							<tn-select :defaultValue="defaultHeight" @confirm="changeHeight" v-model="heightShow" mode="single" :list="heightList">
							</tn-select>
						</tn-form-item>
						<tn-form-item label="体重:" prop="weight">
							<tn-input v-model="form.weight" placeholder="请选择体重 kg" @click="this.weightShow = true" disabled="true"/>
							<tn-select :defaultValue="defaultWeight" @confirm="changeWeight" v-model="weightShow" mode="single" :list="weightList">
							</tn-select>
						</tn-form-item>
						<!-- <tn-form-item label="微信号:" prop="wxNumber">
							<tn-input v-model="form.wxNumber" placeholder="请输入微信号"/>
						</tn-form-item> -->
						<view class="subbtn">
							<tn-button shape="round" backgroundColor="tn-bg-blue" fontColor="tn-color-white"
								@click="subBase">下一步</tn-button>
						</view>

					</tn-form>
				</swiper-item>
				<swiper-item class="swiper__item">
					<tn-form :model="familyForm" ref="form2" :errorType="['message']" labelWidth="140"
						borderBottom="false">
						<tn-form-item label="年薪:" prop="annualSalary">
							<tn-input v-model="familyForm.annualSalary" placeholder="请选择年薪"
								@click="this.annualSalaryShow =true" disabled="true"/>
							<tn-select @confirm="changeAnnualSalary" v-model="annualSalaryShow" mode="single"
								:list="annualSalaryList"></tn-select>
						</tn-form-item>
						<tn-form-item label="从事行业/职务:" prop="inIndustry">
							<tn-input v-model="familyForm.inIndustry" placeholder="请选择行业"
								@click="this.inIndustryShow =true" disabled="true"/>
							<tn-select @confirm="changeInIndustry" v-model="inIndustryShow" mode="single"
								:list="inIndustryList"></tn-select>
						</tn-form-item>
						<!-- <tn-form-item label="岗位性质:" prop="jobNature">
							<tn-input v-model="familyForm.jobNature" placeholder="请选择岗位"
								@click="this.jobNatureShow =true" disabled="true"/>
							<tn-select @confirm="changeJobNature" v-model="jobNatureShow" mode="single"
								:list="jobNatureList"></tn-select>
						</tn-form-item> -->
						<!-- <tn-form-item label="职务:" prop="duties">
							<tn-input v-model="familyForm.duties" placeholder="请选择职务" @click="this.dutiesShow =true" disabled="true"/>
							<tn-select @confirm="changeDuties" v-model="dutiesShow" mode="single" :list="dutiesList">
							</tn-select>
						</tn-form-item> -->
						<!-- <tn-form-item label="购房情况:" prop="houseSituation">
							<tn-radio-group v-model="form.houseSituation">
								<tn-radio v-for="(item, index) in houseSituationList" :key="index" :name="item.name"
									:disabled="item.disabled">
									{{ item.name }}
								</tn-radio>
							</tn-radio-group>
						</tn-form-item>
						<tn-form-item label="持有物业(㎡):" prop="holdProperty">
							<tn-input v-model="familyForm.holdProperty" placeholder="请输入持有物业面积"/>
						</tn-form-item> -->
						<tn-form-item label="购房情况:" prop="houseSituation">  
						  <tn-radio-group v-model="familyForm.houseSituation">  
						    <tn-radio v-for="(item, index) in houseSituationList" :key="index" :name="item.name"  
						      :disabled="item.disabled">  
						      {{ item.name }}  
						    </tn-radio>  
						  </tn-radio-group>  
						</tn-form-item>  
						<tn-form-item v-if="familyForm.houseSituation === '是'" label="持有面积(㎡):">  
						  <!-- <tn-input v-model="familyForm.holdProperty" placeholder="请输入持有物业面积"/>  -->
						  <tn-radio-group v-model="familyForm.houseArea">
						  <tn-radio v-for="(item, index) in houseAreaList" :key="index" :name="item.name"
						    :disabled="item.disabled">  
						    {{ item.name }}  
						  </tn-radio>
						  </tn-radio-group>
						</tn-form-item>
						<tn-form-item label="购车情况:" prop="carSituation">
							<tn-radio-group v-model="familyForm.carSituation">
								<tn-radio v-for="(item, index) in carSituationList" :key="index" :name="item.name"
									:disabled="item.disabled">
									{{ item.name }}
								</tn-radio>
							</tn-radio-group>
						</tn-form-item>
						<tn-form-item v-if="familyForm.carSituation === '是'" label="所购车辆价格:" prop="carPice">
							<tn-radio-group v-model="familyForm.carPrice">
								<tn-radio v-for="(item, index) in carPriceList" :key="index" :name="item.name"
									:disabled="item.disabled">
									{{ item.name }}
								</tn-radio>
							</tn-radio-group>
						</tn-form-item>
						<!-- <tn-form-item label="家庭成员:" prop="familySituation">
				 <tn-input v-model="familyForm.familySituation" placeholder="请选择家庭成员"/>
				</tn-form-item> -->

						<view class="subbtn">
							<tn-button shape="round" backgroundColor="tn-bg-blue" fontColor="tn-color-white"
								@click="subBase2">下一步</tn-button>
						</view>
					</tn-form>
				</swiper-item>
				<swiper-item class="swiper__item">
					<tn-form :model="memberHobby" ref="form3" :errorType="['message']" labelWidth="140"
						borderBottom="false">
						<!-- <tn-form-item label="吸烟:" prop="ifSmoke">
							<tn-radio-group v-model="memberHobby.ifSmoke">
								<tn-radio v-for="(item, index) in ifDrinkList" :key="index" :name="item.name"
									:disabled="item.disabled">
									{{ item.name }}
								</tn-radio>
							</tn-radio-group>
						</tn-form-item>
						<tn-form-item label="喝酒:" prop="ifDrink">
							<tn-radio-group v-model="memberHobby.ifDrink">
								<tn-radio v-for="(item, index) in ifDrinkList" :key="index" :name="item.name"
									:disabled="item.disabled">
									{{ item.name }}
								</tn-radio>
							</tn-radio-group>
						</tn-form-item> -->
						<tn-form-item v-if="memberHobby.sex==0" label="外貌特征:" prop="physicalWomanDesc">
							<div class="radio-groups-container">
							<tn-radio-group v-model="defaultCheckValue1" @change="checkboxGroupChange1">
								<tn-radio v-for="(item, index) in physicalWomanDescList1" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
							</div>
							<div class="radio-groups-container">
							<tn-radio-group v-model="defaultCheckValue2" @change="checkboxGroupChange2">
								<tn-radio v-for="(item, index) in physicalWomanDescList2" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
							</div>
							<div class="radio-groups-container">
							<tn-radio-group v-model="defaultCheckValue3" @change="checkboxGroupChange3">
								<tn-radio v-for="(item, index) in physicalWomanDescList3" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
							</div>
							<tn-radio-group v-model="defaultCheckValue4" @change="checkboxGroupChange4">
								<tn-radio v-for="(item, index) in physicalWomanDescList4" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
						</tn-form-item>
						<tn-form-item v-if="memberHobby.sex==0" label="期待对方:" prop="physicalManDesc">
							<div class="radio-groups-container">
							<tn-radio-group v-model="defaultCheckValue5" @change="checkboxGroupChange5">
								<tn-radio v-for="(item, index) in physicalManDescList1" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
							</div>
							<tn-radio-group v-model="defaultCheckValue6" @change="checkboxGroupChange6">
								<tn-radio v-for="(item, index) in physicalManDescList2" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
						</tn-form-item>
						<tn-form-item v-if="memberHobby.sex==1" label="外貌特征:" prop="physicalManDesc">
							<div class="radio-groups-container">
							<tn-radio-group v-model="defaultCheckValue1" @change="checkboxGroupChange1">
								<tn-radio v-for="(item, index) in physicalManDescList1" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
							</div>
							<tn-radio-group v-model="defaultCheckValue2" @change="checkboxGroupChange2">
								<tn-radio v-for="(item, index) in physicalManDescList2" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
						</tn-form-item>
						<tn-form-item v-if="memberHobby.sex==1" label="期待对方:" prop="physicalWomanDesc">
							<div class="radio-groups-container">
							<tn-radio-group v-model="defaultCheckValue3" @change="checkboxGroupChange3">
								<tn-radio v-for="(item, index) in physicalWomanDescList1" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
							</div>
							<div class="radio-groups-container">
							<tn-radio-group v-model="defaultCheckValue4" @change="checkboxGroupChange4">
								<tn-radio v-for="(item, index) in physicalWomanDescList2" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
							</div>
							<div class="radio-groups-container">
							<tn-radio-group v-model="defaultCheckValue5" @change="checkboxGroupChange5">
								<tn-radio v-for="(item, index) in physicalWomanDescList3" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
							</div>
							<tn-radio-group v-model="defaultCheckValue6" @change="checkboxGroupChange6">
								<tn-radio v-for="(item, index) in physicalWomanDescList4" :key="index" :name="item.name" :disabled="item.disabled">
									{{item.name}}</tn-radio>
							</tn-radio-group>
						</tn-form-item>
						<tn-form-item label="兴趣爱好:" prop="interest">
							<tn-input v-model="memberHobby.interest" placeholder="请填写兴趣爱好" />
							<span v-if="!memberHobby.interest" class="error">兴趣爱好不能为空</span>
						</tn-form-item>
						<tn-form-item label="自我介绍:" prop="selfIntroduction">
							<tn-input type="textarea" v-model="memberHobby.selfIntroduction" placeholder="请填写自我介绍" />
							<span v-if="!memberHobby.selfIntroduction" class="error">自我介绍不能为空</span>
						</tn-form-item>

						<view class="subbtn">
							<tn-button shape="round" backgroundColor="tn-bg-blue" fontColor="tn-color-white"
								@click="subBase3">确定</tn-button>
						</view>
					</tn-form>
				</swiper-item>
			</swiper>
		</view>
	</view>
</template>

<script>
	import template_page_mixin from '@/libs/mixin/template_page_mixin.js';
	import $INFO from '@/common/infoMap.js';
	import $http from '@/common/request.js'
	export default {
		name: 'TemplateInfo',
		mixins: [template_page_mixin],
		data() {
			return {
				defaultHeight:[30],
				defaultWeight:[10],
				defaultRegin:['河南省','郑州市'],
				defaultAddress:['河南省','郑州市'],
				annualSalaryList: $INFO.annualSalary,
				annualSalaryShow: false,
				inIndustryList: $INFO.inIndustry,
				inIndustryShow: false,
				jobNatureList: $INFO.jobNature,
				jobNatureShow: false,
				dutiesList: $INFO.duties,
				dutiesShow: false,
				//carSituationList: $INFO.carSituation,
				carSituationShow: false,
				//houseSituationList: $INFO.houseSituation,
				houseSituationShow: false,
				physicalManDescList1: $INFO.physicalManDesc1,
				physicalManDescList2: $INFO.physicalManDesc2,
				physicalWomanDescList1: $INFO.physicalWomanDesc1,
				physicalWomanDescList2: $INFO.physicalWomanDesc2,
				physicalWomanDescList3: $INFO.physicalWomanDesc3,
				physicalWomanDescList4: $INFO.physicalWomanDesc4,
				defaultCheckValue1: '',
				defaultCheckValue2: '',
				defaultCheckValue3: '',
				defaultCheckValue4: '',
				defaultCheckValue5: '',
				defaultCheckValue6: '',
				ifDrinkList: $INFO.ifDrink,
				rules: {
					birthday: [{
						required: true,
						message: '请选择出生日期',
						//trigger: 'change'
					}],
					educationBackground: [{
						required: true,
						message: '请选择学历',
						//trigger: 'change'
					}],
					marriageHistory: [{
						required: true,
						message: '请选择婚史',
						//trigger: 'change'
					}],
					haveChild: [{
						required: true,
						message: '请选择是否有子女',
						//trigger: 'change'
					}],
					nation: [{
						required: true,
						message: '请选择民族',
						//trigger: 'change'
					}],
					birthPlace: [{
						required: true,
						message: '请选择家乡',
						//trigger: 'change'
					}],
					presentPlace: [{
						required: true,
						message: '请选择现居地',
						//trigger: 'change'
					}],
					sex: [{
						required: true,
						message: '请选择性别',
						//trigger: 'change'
					}]
				},
				rules2: {
					annualSalary: [{
						required: true,
						message: '请选择年薪',
					}],
				},
				nations: this.getNations(),
				heightList: this.getHeight(),
				weightList: this.getWeight(),
				educationBackgroundShow: false,
				heightShow: false,
				weightShow: false,
				nationsShow: false,
				marriedShow: false,
				addressShow: false,
				addressParams: {
					province: true,
					city: true,
					area: true
				},
				birthAddressShow: false,
				birthAddressParams: {
					province: true,
					city: true,
					area: true
				},
				params: {
					year: true,
					month: true,
					day: true,
					hour: false,
					minute: false,
					second: false
				},
				form: {
					presentPlace: '',
					birthPlace: '',
					nation: '',
					sex: '',
					marriageHistory: '',
					educationBackground: '',
					birthday: '',
					height: '',
					weight: '',
					// wxNumber: ''
				},
				familyForm: {
					annualSalary: '',
					carSituation: '',
					duties: '',
					familySituation: '',
					houseSituation: '',
					inIndustry: '',
					jobNature: '',
					houseArea: '',
					carPrice: '',
				},
				memberHobby: {
					ifDrink: 0,
					ifSmoke: 0,
					interest: '', //兴趣爱好
					personalityTraits: '', //性格特征
					physicalWomanDesc: '', //女生外貌描述
					physicalManDesc: '', //男生外貌描述
					selfIntroduction: '', //自我介绍
					sex: ''
				},
				radioList: $INFO.education,
				sexRadioList: [{
						name: '男',
						value: 1,
						disabled: false
					},
					{
						name: '女',
						value: 0,
						disabled: false
					}
				],
				houseSituationList: [{
						name: '是',
						value:1,
						disabled: false
					},
					{
						name: '否',
						value:0,
						disabled: false
					}
				],
				houseAreaList: [{
						name: '0-100m²',
						disabled: false,
						value:0
					},
					{
						name: '100-200m²',
						disabled: false,
						value:1
					},
					{
						name: '200-500m²',
						disabled: false,
						value:2
					},{
						name: '500m²以上',
						disabled: false,
						value:3
					}
				],
				carSituationList: [{
						name: '是',
						disabled: false,
						value:1
					},
					{
						name: '否',
						disabled: false,
						value:0
					}
				],
				carPriceList: [{
						name: '15万以内',
						disabled: false,
						value:0
					},
					{
						name: '15万-25万',
						disabled: false,
						value:1
					},
					{
						name: '25万-40万',
						disabled: false,
						value:2
					},
					{
						name: '40万以上',
						disabled: false,
						value:3
					},
				],
				smailRadioList: [
					{
						name: '未婚',
						disabled: false,
						value:0
					},
					{
						name: '离异',
						disabled: false,
						value:1
					}
				],
				childList: [{
						name: '无子女',
						disabled: false,
						value:0
					},
					{
						name: '有且跟随己方',
						disabled: false,
						value:1
					},
					{
						name: '有但归对方',
						disabled: false,
						value:2
					}
				],
				checkboxList: [{
						name: '编程',
						checked: false,
						disabled: false
					},
					{
						name: '羽毛球',
						checked: false,
						disabled: false
					},
					{
						name: '篮球',
						checked: false,
						disabled: false
					}
				],
				list: [{
						name: '基本资料'
					},
					{
						name: '工作家庭'
					},
					{
						name: '性格爱好'
					},
				],
				tabsIndex: 0,
				swiperIndex: 0,
				sex: '',
				Appearance: [],//外貌特征
				isInitialized: false, // 添加一个标志位来跟踪是否已经初始化
			}
		},
		onShow() {
			if (!this.isInitialized) { // 检查是否已经初始化  
				this.initData();  
			    this.isInitialized = true; // 标记为已初始化  
				
			    }  
		},
		onReady() {
			this.$refs.form.setRules(this.rules);
			this.$refs.form2.setRules(this.rules2);
		},
		methods: {
			turnLogin() {
				uni.removeStorageSync("token")
				uni.removeStorageSync("userInfo")
				uni.navigateTo({
					url: '/minePages/login',
				});
			},
			initData() {
				$http.get("friend/wx/personal/getMemberInfo").then(ttt => {
					let r = ttt[1].data
					if (r.code == 20000) {

						if (r.data.memberInfo) {
							this.form = r.data.memberInfo

							this.form.marriageHistory = this.form.marriageHistory == 1 ? "离异" : "未婚";
							this.form.sex = this.form.sex == 1 ? "男" : "女";	
							
							var arr = this.childList.filter(re=>{
								return re.value == this.form.haveChild
							})
							
							if(arr.length>0){
								this.form.haveChild = arr[0].name
							}
							
							if(this.form.height && this.form.height > 0){
								this.heightList.forEach((item, index)=>{
									if(item.value == this.form.height){
										this.defaultHeight = [index]
									}
								})
							}
							
							if(this.form.weight && this.form.weight > 0){
								this.weightList.forEach((item, index)=>{
									if(item.value == this.form.weight){
										this.defaultWeight = [index]
									}
								})
							}

						}
						if (r.data.memberFamily) {
							this.familyForm = r.data.memberFamily
							
							
							this.familyForm.houseSituation = this.familyForm.houseSituation == 1 ? "是" : "否"
							

							var arr = this.houseAreaList.filter(re=>{
								return re.value == this.familyForm.houseArea
							})
							
							if(arr.length>0){
								this.familyForm.houseArea = arr[0].name
							}
							
							this.familyForm.carSituation = this.familyForm.carSituation == 1 ? "是" : "否"
							
							
							var arr2 = this.carPriceList.filter(re=>{
								return re.value == this.familyForm.carPrice
							})
							
							if(arr2.length>0){
								this.familyForm.carPrice = arr2[0].name
							}
						}
						if (r.data.memberHobby) {
							this.memberHobby = r.data.memberHobby
							this.sex=uni.getStorageSync('userInfo').sex;
							this.memberHobby.sex = this.sex;
							// this.memberHobby.ifDrink = this.memberHobby.ifDrink == 0 ? "否" : "是";
							// this.memberHobby.ifSmoke = this.memberHobby.ifSmoke == 0 ? "否" : "是";

							if (this.memberHobby.personalityTraits.length > 0 ) {
								// this.defaultCheckValue = this.memberHobby.personalityTraits.split(",")
								this.Appearance = this.memberHobby.personalityTraits.split(",");
								this.defaultCheckValue1 = this.Appearance[0];
								this.defaultCheckValue2 = this.Appearance[1];
								this.defaultCheckValue3 = this.Appearance[2];
								this.defaultCheckValue4 = this.Appearance[3];
								this.defaultCheckValue5 = this.Appearance[4];
								this.defaultCheckValue6 = this.Appearance[5];
							}

						}

					} else if (r.code == 401) {
						this.turnLogin()
					}
				})

			},
			// 选中某个复选框时，由checkbox时触发
			checkboxChange(e) {
				console.log(e);
			},
			// // 选中任一checkbox时，由checkbox-group触发
			// checkboxGroupChange(e) {
			// 	 console.log(e)
			// 	// this.memberHobby.personalityTraits = e.join(",") 
			
			// 	if (this.memberHobby.personalityTraits) {  
			// 	  // 如果 this.memberHobby.personalityTraits 不为空，则在其后面添加逗号和新的性格特征  
			// 	  this.memberHobby.personalityTraits += ',' + e;  
			// 	} else {  
			// 	  // 如果 this.memberHobby.personalityTraits 为空，则直接赋值新的性格特征  
			// 	  this.memberHobby.personalityTraits = e;  
			// 	}
			// },
			// checkboxGroupChange(e) {  
			//   console.log(e);  
			// 	console.log(this.memberHobby.personalityTraits)
			//   // 将性格特征字符串转换为数组，方便检查是否包含某个特征  
			//   const traitsArray = this.memberHobby.personalityTraits ? this.memberHobby.personalityTraits.split(',') : [];  
			    
			//   //检查 e 是否已经在 traitsArray 中  
			//   if (!traitsArray.includes(e)) {  
			//     //如果 e 不在 traitsArray 中，则添加它  
			//     this.memberHobby.personalityTraits = traitsArray.concat(e).join(',')
			//   } 
			//   console.log(traitsArray)
			// },
			checkboxGroupChange1(e) {
			console.log(e);
			this.Appearance[0] = e;
			console.log(this.Appearance); 
			},
			checkboxGroupChange2(e) {
			  console.log(e);  
			  this.Appearance[1] = e;
			  console.log(this.Appearance);  
			},
			checkboxGroupChange3(e) {
			  console.log(e);  
			  this.Appearance[2] = e;
			  console.log(this.Appearance);  
			},
			checkboxGroupChange4(e) {
			  console.log(e);  
			  this.Appearance[3] = e;
			  console.log(this.Appearance);  
			},
			checkboxGroupChange5(e) {
			  console.log(e);  
			  this.Appearance[4] = e;
			  console.log(this.Appearance);  
			},
			checkboxGroupChange6(e) {
			
			  console.log(e);  
			  this.Appearance[5] = e;
			   
			},
			changeAnnualSalary(e) {
				this.familyForm.annualSalary = e[0].label
			},
			changeInIndustry(e) {
				this.familyForm.inIndustry = e[0].label
			},
			changeDuties(e) {
				this.familyForm.duties = e[0].label
			},
			changeJobNature(e) {
				this.familyForm.jobNature = e[0].label
			},
			changeFamilySituation(e) {
				this.familyForm.familySituation = e[0].label
			},
			changeHouseSituation(e) {
				this.familyForm.houseSituation = e[0].label
			},
			changeCarSituation(e) {
				this.familyForm.carSituation = e[0].label
			},
			subBase3() {
				if (!this.memberHobby.interest || !this.memberHobby.selfIntroduction) {
				        console.log('请填写必填项');
						uni.showModal({
						    title: '提示',  
						    content: '请填写兴趣爱好和自我介绍',  
						    showCancel: false, // 不显示取消按钮   
						});
				        return;
				      }
				const appearanceString = this.Appearance.join(','); // 使用逗号连接数组元素  
				 // 将转换后的字符串赋值给 this.memberHobby.personalityTraits  
				this.memberHobby.personalityTraits = appearanceString;  
				console.log(this.memberHobby.personalityTraits); // 输出更新后的字符串 
				$http.post("friend/wx/personal/updateMemberInfo", {
					"memberHobby": this.memberHobby
				}).then(ttt => {
					let r = ttt[1].data
					if (r.code == 20000) {
						$http.get("friend/wx/personal/selectPictures").then( tt=> {
							let a = tt[1].data
							if (a.code == 20000) {
								// console.log()
								// console.log("图片数量"+a.data.length)
							if(a.data.length>0){
								uni.navigateTo({
									url: '/pages/index',
								});
							}else{
								uni.navigateTo({
								  url: '/pages/mine/photo' // 注意这里的路径格式，通常不需要双斜杠  
								}); 
							}
							}
						
					})
					}else if(r.code == 401) {
						uni.removeStorageSync("token")
						uni.removeStorageSync("userInfo")
						uni.navigateTo({
							url: '/minePages/login',
						});
					}
				})
			},
			subBase2() {
				this.$refs.form2.validate(valid => {
					if (valid) {
						
						this.familyForm.houseSituation = this.familyForm.houseSituation == "否" ? 0 : 1; 
						//if()
						console.log(this.houseAreaList)
						var arr = this.houseAreaList.filter(re=>{
							return re.name == this.familyForm.houseArea
						})
						
						if(arr.length>0){
							this.familyForm.houseArea = arr[0].value
						}
						
						this.familyForm.carSituation = this.familyForm.carSituation == "否" ? 0 : 1; 
						
						var arr2 = this.carPriceList.filter(re=>{
							return re.name == this.familyForm.carPrice
						})
						
						if(arr2.length>0){
							this.familyForm.carPrice = arr2[0].value
						}
						
						
						$http.post("friend/wx/personal/updateMemberInfo", {
							"memberFamily": this.familyForm
						}).then(ttt => {
							let r = ttt[1].data
							if (r.code == 20000) {
								// ....
								console.log(this.form.sex)
								this.tabsChange(2)
							} else if (r.code == 401) {
								uni.removeStorageSync("token")
								uni.removeStorageSync("userInfo")
								uni.navigateTo({
									url: '/minePages/login',
								});
							}
						})
					} else {

					}
				})
			},
			subBase() {
				this.$refs.form.validate(valid => {
					if (valid) {
						console.log("验证成功")
						
						
						// $http.get("friend/wx/personal/selectPictures").then( tt=> {
						// 	let a = tt[1].data
							// if (a.code == 20000) {
								// ....
								// console.log()
								// console.log("图片数量"+a.data.length)
							// if(a.data.length>0){
								this.form.marriageHistory = this.form.marriageHistory == "离异" ? 1 : 0;
								this.form.sex = this.form.sex == "女" ? 0 : 1;
								
								var arr = this.childList.filter(re=>{
									return re.name == this.form.haveChild
								})
								
								if(arr.length>0){
									this.form.haveChild = arr[0].value
								}
								
								
								$http.post("friend/wx/personal/updateMemberInfo", {
									"memberInfo": this.form
								}).then(ttt => {
									let r = ttt[1].data
									if (r.code == 20000) {
										// ....
								
										this.tabsChange(1)
									} else if (r.code == 401) {
										uni.removeStorageSync("token")
										uni.removeStorageSync("userInfo")
										uni.navigateTo({
											url: '/minePages/login',
										});
									}
								
									console.log(ttt)
								})
							// }else{
							// 	uni.showModal({  
							// 	  content: "请前往个人相册完善您的相册",  
							// 	  success: function (res) {  
							// 	    if (res.confirm) {  
							// 	      // 用户点击了确定按钮  
							// 	      uni.navigateTo({  
							// 	        url: '/pages/mine/photo' // 注意这里的路径格式，通常不需要双斜杠  
							// 	      });  
							// 	    } else if (res.cancel) {  
							// 	      // 用户点击了取消按钮  
							// 	      console.log('用户点击了取消');  
							// 	    }  
							// 	  }  
							// 	});
							// }
								
						// 	} else if (a.code == 401) {
						// 		uni.removeStorageSync("token")
						// 		uni.removeStorageSync("userInfo")
						// 		uni.navigateTo({
						// 			url: '/minePages/login',
						// 		});
						// 	}
						// })

						
					} else {
						console.log('验证失败');
					}
				});
			},
			changeHeight(e) {
				this.form.height = e[0].value
			},
			changeWeight(e) {
				this.form.weight = e[0].value
			},
			showAddress() {
				this.addressShow = true
			},
			choseAddress(e) {
				this.form.presentPlace = e.province.label + e.city.label + e.area.label
			},
			showBirthAddress() {
				this.birthAddressShow = true
			},
			choseBirthAddress(e) {
				this.form.birthPlace = e.province.label + e.city.label + e.area.label
			},
			changeEducation(e) {
				this.form.educationBackground = e[0].label
			},
			choseNation(e) {
				this.form.nation = e[0].label
				this.$forceUpdate()
			},
			showNations() {
				this.nationsShow = true
			},
			getWeight() {
				let result = [];
				for (let i = 40; i < 101; i++) {
					result.push({
						value: i,
						label: i + "Kg"
					});
				}
				return result;
			},
			getHeight() {
				let result = [];
				for (let i = 140; i < 201; i++) {
					result.push({
						value: i,
						label: i + "cm"
					});
				}
				return result;
			},
			getNations() {
				let result2 = ["汉族", "蒙古族", "回族", "藏族", "维吾尔族", "苗族", "彝族", "壮族", "布依族", "朝鲜族", "满族", "侗族", "瑶族", "白族",
					"土家族", "哈尼族", "哈萨克族", "傣族", "黎族", "傈僳族", "佤族", "畲族", "高山族", "拉祜族", "水族", "东乡族", "纳西族", "景颇族",
					"柯尔克孜族", "土族", "达斡尔族", "仫佬族", "羌族", "布朗族", "撒拉族", "毛南族", "仡佬族", "锡伯族", "阿昌族", "普米族", "塔吉克族", "怒族",
					"乌孜别克族", "俄罗斯族", "鄂温克族", "德昂族", "保安族", "裕固族", "京族", "塔塔尔族", "独龙族", "鄂伦春族", "赫哲族", "门巴族", "珞巴族",
					"基诺族"
				];
				let result = [];
				for (let i = 0; i < result2.length; i++) { // 例如，我们生成10个这样的对象
					result.push({
						value: result2[i],
						label: result2[i]
					});
				}

				return result;
			},
			changeDate(e) {
				let _date = e.year + "-" + e.month + "-" + e.day
				this.form.birthday = _date
			},
			showAarried() {
				this.marriedShow = true
			},
			showEducation() {
				this.educationBackgroundShow = true
			},
			// 标签栏值发生改变
			tabsChange(index) {
				this.swiperIndex = index
			},
			// swiper-item位置发生改变
			swiperTransition(event) {
				this.$refs.tabs.setDx(event.detail.dx)
			},
			// swiper动画结束
			swiperAnimationFinish(event) {
				const current = event.detail.current
				this.$refs.tabs.setFinishCurrent(current)
				this.swiperIndex = current
				this.tabsIndex = current
			}
		}
	}
</script>

<style lang="scss" scoped>
	.order-wrap {
		display: flex;
		flex-direction: column;
		height: calc(100vh - var(--window-top));
		width: 100%;
	}

	.swiper {
		&__box {
			flex: 1;
			padding: 10px 20px;
		}

		&__item {
			height: 100%;
		}
	}

	/* 胶囊*/
	.tn-custom-nav-bar__back {
		width: 60%;
		height: 100%;
		position: relative;
		display: flex;
		justify-content: space-evenly;
		align-items: center;
		box-sizing: border-box;
		background-color: rgba(0, 0, 0, 0.15);
		border-radius: 1000rpx;
		border: 1rpx solid rgba(255, 255, 255, 0.5);
		color: #FFFFFF;
		font-size: 18px;

		.icon {
			display: block;
			flex: 1;
			margin: auto;
			text-align: center;
		}

	}


	/* 间隔线 start*/
	.tn-strip-bottom-min {
		width: 100%;
		border-bottom: 1rpx solid #F8F9FB;
	}

	.tn-strip-bottom {
		width: 100%;
		border-bottom: 20rpx solid rgba(241, 241, 241, 0.8);
	}

	/* 间隔线 end*/

	.userinfo {
		padding: 20upx 20upx;
	}

	.userinfo>view>* {
		font-size: 35upx;
		height: 100%;
	}

	/* .userinfo>view>view:nth-of-type(1){
  	width: 30%;
  }
  .userinfo>view>view:nth-of-type(2){
  	color: #AAAAAA;
  	width: 60%;
  } */
	.userinfo>view {
		display: flex;
		margin-top: 20upx;
	}

	.userinfo input {
		height: 100%;
		width: 100%;
	}

	.subbtn {
		margin-top: 18px;
		text-align: center;
	}
	.radio-groups-container {  
	  margin-bottom: 20px; /* 或者你想要的任何间距值 */  
	}
	  .error {
	    color: red;
	  }
</style>
